package com.ruoyi.jksd.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.jksd.common.dto.XyBankinfoDto;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.jksd.domain.XyBankinfo;
import com.ruoyi.jksd.service.IXyBankinfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 会员-银行卡信息Controller
 * 
 * @author ruoyi
 * @date 2024-05-26
 */
@RestController
@RequestMapping("/xybankinfo/xybankinfo")
public class XyBankinfoController extends BaseController
{
    @Autowired
    private IXyBankinfoService xyBankinfoService;

    /**
     * 查询会员-银行卡信息列表
     */
    @PreAuthorize("@ss.hasPermi('xybankinfo:xybankinfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(XyBankinfo xyBankinfo)
    {
        startPage();
        List<XyBankinfo> list = xyBankinfoService.selectXyBankinfoList(xyBankinfo);
        return getDataTable(list);
    }

    /**
     * 导出会员-银行卡信息列表
     */
    @PreAuthorize("@ss.hasPermi('xybankinfo:xybankinfo:export')")
    @Log(title = "会员-银行卡信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, XyBankinfo xyBankinfo)
    {
        List<XyBankinfo> list = xyBankinfoService.selectXyBankinfoList(xyBankinfo);
        ExcelUtil<XyBankinfo> util = new ExcelUtil<XyBankinfo>(XyBankinfo.class);
        util.exportExcel(response, list, "会员-银行卡信息数据");
    }

    /**
     * 获取会员-银行卡信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('xybankinfo:xybankinfo:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(xyBankinfoService.selectXyBankinfoById(id));
    }

    /**
     * 新增会员-银行卡信息
     */
    @PreAuthorize("@ss.hasPermi('xybankinfo:xybankinfo:add')")
    @Log(title = "会员-银行卡信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody XyBankinfo xyBankinfo)
    {
        return toAjax(xyBankinfoService.insertXyBankinfo(xyBankinfo));
    }

    /**
     * 修改会员-银行卡信息
     */
    @PreAuthorize("@ss.hasPermi('xybankinfo:xybankinfo:edit')")
    @Log(title = "会员-银行卡信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody XyBankinfo xyBankinfo)
    {
        return toAjax(xyBankinfoService.updateXyBankinfo(xyBankinfo));
    }

    /**
     * 修改会员-银行卡信息
     */
    @PostMapping("/editAddressAndpwd2")
    public AjaxResult editAddressAndpwd2(@RequestBody XyBankinfoDto xyBankinfoDto)
    {
        return xyBankinfoService.editAddressAndpwd2(xyBankinfoDto);
    }

    /**
     * 删除会员-银行卡信息
     */
    @PreAuthorize("@ss.hasPermi('xybankinfo:xybankinfo:remove')")
    @Log(title = "会员-银行卡信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(xyBankinfoService.deleteXyBankinfoByIds(ids));
    }
}
